mkdir lab
cd lab
cp /etc/default/* . 2> /dev/null
ls | head -5
du . -h # disk usage
tar -c -f file.tar *
ls -lh file.tar
ls * | grep -v tar | wc -l
shopt -s extglob # extended pattern matching syntax
rm !(file.tar)
ls
tar -x -f file.tar
ls | head -5 | tr '\n' ' '
rm !(file.tar)
ls
gzip -9 -k file.tar # -1 fast : -9 best
ls -lh
rm file.tar
ls
gzip --decompress file.tar.gz # -d, --uncompress, gunzip
ls -lh
tar -x -f file.tar
gzip -k -9 file.tar; ls
file file.tar.gz
cat file.tar.gz | gunzip > file.tar # get the input from stdin
gzip -d -c file.tar.gz > file2.tar # Write output on standard output
zcat file.tar.gz # similar to -> gunzip -c, gzip -d -c
ls -lhrt
rm !(file.tar) 2> /dev/null; ls
bzip2 -9 file.tar
ls -lh
bunzip2 file.tar.bz2
ls
bzip2 file.tar
ls -lh
bzcat file.tar.bz2 > new.tar
bzip2 -d -c file.tar.bz2 > another.tar # -c : Write the output on standard output
bunzip2 -c file.tar.bz2 > file.tar
cat file.tar.bz2 | bunzip2 > newfile.tar # cat file.tar.bz2 | bzip2 -d > newfile.tar
md5sum *.tar
rm !(file.tar)
xz -k file.tar
ls -lh
ls
tar -xf file.tar
rm file.tar
ls | wc -l
du -h .
mkdir cmp
tar -c -z -f cmp/my.tar.gz *
tar -cjf cmp/my.tar.bz2 *
tar -cJf cmp/my.tar.xz *
file cmp/*
ls -lh cmp/*
GZIP=-9 tar -cjf cmp/file.tar.gz * --exclude cmp
ls cmp/file.tar.gz -lh
tar -xOf cmp/my.tar.gz > a.tar # extract to stdout
tar -t -f cmp/my.tar.gz | head -4 # list
tar -cf test.tar /etc/grub.d 2> /dev/null
tar -tf test.tar | tail -1
tar -cPf test.tar /etc/grub.d 2> /dev/null # keep the leading /
tar -tf test.tar 2> /dev/null | tail -1
tar -cf test.tar -C /etc/grub.d . # Change dir
tar -tf test.tar | tail -1
find /etc/grub.d/ | tar -cf grub.tar -T - -Pp # From stdin while keeping the / and permissions
rm -r *
echo 'hi 1' > 1 ; echo 'hi 2' > 2
tar -cf 1.tar 1; tar -cf 2.tar 2;
rm 1 2
ls -l
tar -xOf 1.tar # -O: to the stdout
echo 'bye 1' > 1
tar -uf 1.tar 1 # update file 1 if it's newer
tar -tf 1.tar # list files
tar -xOf 1.tar
tar -xf 2.tar --occurrence=1 filename
tar -xf 2.tar --backup filename # 1 1~
tar -A 1.tar -f 2.tar # Appends 1.tar into 2.tar
tar -f 2.tar -t # list files
tar -f 2.tar -xO
rm 1 # remove the new one we just creat it
tar -f 2.tar -x 1 # only extract file with the name `1`
ls
cat 1
tar -tf 1.tar
tar -r -f 1.tar 2
tar -tf 1.tar
tar -f 2.tar --delete 1
tar -tf 2.tar # list files
tar -f 2.tar --delete --occurrence=2 filename
whatis cpio
find /etc/grub.d | head -3
find /etc/grub.d | cpio -o > grub-d.cpio
file grub-d.cpio
cpio -id --no-absolute-filenames < grub-d.cpio
ls
rm -r etc grub-d.cpio
ls /boot/init*
cp /boot/initrd.img-4.4.0-75-generic .
file initrd.img-4.4.0-75-generic
zcat initrd.img-4.4.0-75-generic | cpio -id --no-absolute-filenames
rm initrd.img-4.4.0-75-generic
ls
The zip program puts one or more compressed files into a single zip archive, along with information about the files (name, path, date, time of last modifica‐ tion, protection, and check information to verify file integrity).
zip my.zip grub.tar
ls -lh
rm -r *
zip -jr9 grub.d.zip /etc/grub.d/ # junk the path
ls -lh
file grub.d.zip
unzip -l grub.d.zip
the names, uncompressed file sizes and modification dates and times of the specified files are printed, along with totals for all files specified.
unzip -v grub.d.zip
zipinfo -2 grub.d.zip # read the man page, got a bunch of options to handle the list
zip -e my.zip /etc/ # encrypt using password
zipcloak my.zip # after creation
zipcloak -d my.zip # remove encryption
zip -jj9r w3m.zip /etc/w3m/
unzip -v w3m.zip
zipnote w3m.zip
nano tmp
@ config
Comment by ravexina (Milad As)
@ (comment above this line)
@ mailcap
github.com/ravexina/
@ (comment above this line)
@ (zip file comment below this line)
zipnote -w w3m.zip < tmp
zipnote w3m.zip
unzip -l w3m.zip
Save it in tmp
@ config
@=newconfig-name
Comment by ravexina (Milad As)
@ (comment above this line)
@ mailcap
github.com/ravexina/
@ (comment above this line)
@ (zip file comment below this line)
zipnote -w w3m.zip < tmp
zipinfo -2 w3m.zip
man pages of: tar, gzip, bzip2, xz, zip, unzip, zipinfo, zipnote and cpio
https://www.gnu.org/software/cpio/manual/html_mono/cpio.html
https://www.gnu.org/software/tar/manual/tar.html
http://www.info-zip.org/mans/unzip.html
ipynb
format: https://github.com/ravexina/linux-notes. html
exports of project available at: https://ravexina.github.io/linux-notes.Linux Notes by Milad As (Ravexina) is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.